package com.dolphin.apipassenger.controller;

import com.dolphin.apipassenger.service.TokenService;
import com.dolphin.common.dto.ResponseResult;
import com.dolphin.common.response.TokenResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class TokenController {
    @Autowired
    TokenService tokenService;
    @PostMapping("/token-refresh")
    public ResponseResult refreshToken(@RequestBody TokenResponse tokenResponse) {
        String refreshToken = tokenResponse.getRefreshToken();
        log.info("原来refreshToken:"+refreshToken);
        return tokenService.refreshToken(refreshToken);
    }
}
